function [r] = sse(P, C)
% SSE Compute the SSE of the list of points
%   P - the list of points; an Nx3 matrix; the third column
%       is the index of cluster
%   C - the list of centers; an Mx2 matrix
%   r - the SSE

% % % Write your code here % % % 
r = 0;
for i = 1:size(C,1)
    r = r+sum((P(P(:,3) == i, 1)-C(i,1)).^2+(P(P(:,3) == i, 2)-C(i,2)).^2);
end
end